const express = require('express');
const app = express();
const httpServer = require('http').createServer(app);
const server = require('socket.io').Server;
const io = new server(httpServer, {
    cors: {
        origin: [
            "http://localhost:510", "http://localhost:8081", "http://localhost:8082"],
    }
});

app.set('secret', '8sh983ho209s');

app.use(require('cors')());
app.use(express.json());

app.use('/', express.static(__dirname + '/public/web'))
app.use('/uploads', express.static(__dirname + '/uploads'));

require('./routes/web')(app);
require('./plugins/db')(app);
require('./routes/socket')(io, app);

httpServer.listen(510);